<?php
namespace  Superadmins\Controller;
use Think\Auth;
use Think\Controller;

class CommonController extends  Controller
{
	public function _initialize()
	{
		$auth=new Auth();
		$uid=$_SESSION['onethink_home']['user_auth']['uid'];
		$auth_bool=$auth->check('superadmin', $uid);
	    if($auth_bool==false && is_administrator($uid)==false)
	    {
	     	$this->error('您不是高级管理员用户',U('/Home/index'));
	    	exit('<script>top.location.href='.U('/Home/index').'</script>');
	    }
	    	$title='编辑管理后台';
			$this->assign('title',$title);
	
		
	}

		public function fileUpload($path)
		{
			$upload = new \Think\Upload();// 实例化上传类    
			$upload->maxSize   =     3145728 ;// 设置附件上传大小   
			$upload->exts      =     array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
			if($path)
			{
				$upload->rootPath  =     './Public/';
				$upload->savePath  =      $path;
				$upload->saveName  = 	 time().'_'.mt_rand();
			}
			else
				$upload->savePath  =      'school_logo/'; // 设置附件上传目录    // 上传文件

			$info   =   $upload->upload();

		 	if($info){
		 		return $info;
		 	}else{
		 		return false;
		 	}
		}

	
	


}